<?php 
	if($data['postText']):
		$pt = $data['postText'];
	endif;
?>
			
            <div>
             <ul class="breadcrumb-arrow">
          	<li><a href="<?php echo HOME; ?>"><i class="fa fa-home"></i> Home</a></li>
            <li><a href="<?php echo HOME ?>user/upload">Upload</a></li>
            <li><a href="<?php echo url(); ?>">Blog</a></li>
          </ul>
    
	
		<div class="user_profile">

			<div class="row">
				<div class="col-md-12 ">
					<div id="contentIndex" class="col-md-12">
						<div role="dialog" id="modalAlertBox" class="modal fade"
							style="display: none;">
							<div class="modal-dialog modal-wide">
								<div class="modal-content">
									<div class="modal-header">
										<button type="button" class="close" data-dismiss="modal"
											aria-hidden="true">&times;</button>
										<h4 class="modal-title"></h4>
									</div>
									<div class="modal-body">

										<div style="clear: both"></div>
									</div>
								</div>
								<!-- /.modal-content -->
							</div>
						</div>

						<div id="wrapLoadMoreItems">
							<div class="normalLoadBtn" id="loadMoreItems">
								<img width="20" alt="loading" src="public/images/loading.gif">
								Loading
							</div>
							<br>
						</div>
						<div class="formLoading"></div>
						
						<div class="generalError" style="display: none;"></div>
						
					
                        
                        
                        
                        
                        
                       <form id="formMainImage" role="form" method="post" enctype="multipart/form-data" data-upload-template-id="template-upload-1"> 
<div class="row">
<div class="col-md-3">Hình ảnh đại diện</div>
<div class="col-md-9">	
<input type="hidden" name="news_image_link" id="news_image_link" value="" /> 
											<input type="file" name="files[]" class="form-control" /> <br />
											
											<table role="presentation" class="table table-striped">
												<tbody class="files"></tbody>
											</table>
											<input id="mainImage" type="hidden" name="mainImage" />
                                           
</div>
</div>
 </form>
 
	<form id="textUpload" class="userPostForm" role="form" method="post" enctype="multipart/form-data" data-upload-template-id="template-upload"  data-download-template-id="template-download">
    <table class="table table-bordered table-striped">
<tbody >                    
 <tr ><td>Tiêu đề </td> <td><input type="text" class="form-control" value="<?php echo2 ($pt['title']); ?>" id="txtTitle" placeholder="Nhập tiêu đề..."></td> </tr>                                           
<tr ><td>Giới thiệu </td> <td>		<textarea  class="form-control" id="txtsdes" name="txtsdes" 
											placeholder="Nhập giới thiệu ngắn ( ít nhất phải dài 150 ký tự)..." style="height:100px" ><?= $pt['sdes']; ?>	</textarea>
 </td> </tr>
<tr ><td>Chọn danh mục </td> <td><?php echo cmsSelect('txtCat', $pt['cat_id'], $data['categories'], array('class'=>'myNormalSelect select2')); ?></td> </tr>

<tr ><td>Playlist </td> <td>				<select id="txtAlbum" class="myNormalSelect select2">
                                                <option value="">Tùy Chọn Playlist</option>	
													<?php if($data['albums']):?>
													<?php 
														foreach($data['albums'] as $value): 
															if($pt['album_id'] == $value['id']):
																$selected = 'selected="selected"';
															endif;
													?>
													<option <?= $selected; ?> value="<?= $value['id']; ?>"><?= $value['name'] ?></option>	
													<?php unset($selected); endforeach; ?>
													<?php endif;?>
												</select>
												
												<button type="submit" class="btn btn-sm createAlbum">
							                    	<i class="glyphicon glyphicon-plus"></i>
								                    <span>Tạo Playlist mới</span>
								                </button>
</td> </tr>
<tr ><td colspan="2"><textarea class="form-control" placeholder="Nhập mô tả..." id="txtDescription" rows="5"><?= $pt['description'] ?></textarea></td></tr>
<tr ><td>Thêm ảnh vào bài viết</td><td >
<div class="jumbotron" style="overflow: hidden">
									<!-- Redirect browsers with JavaScript disabled to the origin page -->
									<noscript>
										<input type="hidden" name="redirect"
											value="http://blueimp.github.io/jQuery-File-Upload/">
									</noscript>
									<!-- The fileupload-buttonbar contains buttons to add/delete files and start/cancel the upload -->
									<div class="fileupload-buttonbar">
										<div>
											<!-- The fileinput-button span is used to style the file input field as button -->
											<span class="btn btn-success fileinput-button"> <i
												class="glyphicon glyphicon-plus"></i> <span>Tìm ảnh...</span>
												<input type="file" name="files[]" id="additionImages" multiple accept="image/*">
											</span>
	
											<button type="submit" class="btn btn-primary start">
												<i class="glyphicon glyphicon-upload"></i> <span>Upload hình</span>
											</button>
											<!-- The loading indicator is shown during file processing -->
											<span class="fileupload-loading"></span>
										</div>
										<!-- The global progress information -->
										<div class="fileupload-progress fade">
											<!-- The global progress bar -->
											<div class="progress progress-striped active" style="margin-bottom: 0px"
												role="progressbar" aria-valuemin="0" aria-valuemax="100">
												<div class="progress-bar progress-bar-success"
													style="width: 0%;"></div>
											</div>
											<!-- The extended global progress information -->
											
										</div>
									</div>
									<!-- end .fileupload-buttonbar -->
	
									<!-- The table listing the files available for upload/download -->
									<table role="presentation" class="table table-striped">
										<tbody class="files"></tbody>
									</table>
									<div>
										<div id="uploadedFile"></div>
									</div>
									<!-- <div class="form-group">
													<div class="field_error" id="txtImage_error"></div>
													<label for="txtImage">Chọn hình:</label>
													<input type="file" id="txtImage">
												</div><br /> -->
									</div>
								</div>
							
</td></tr>                                               

<tr > <td colspan="2" align="center" >		<button type=submit class="btn btn-primary mySubmit" id="submitText">
										<i class="glyphicon glyphicon-hand-up"></i> <span><?php 	if($data['postText']){ echo 'Cập Nhật Bài Viết';}else{ echo 'Đăng bài';}?></span>
									</button>
                                    </td> </tr>
                                    
 <tr>
 <td colspan="2">
 
 
<h3>Hỗ Trợ BBCode : <em>Chèn link và Youtube video vào bài viết</em></h3>
<table class="table table-bordered table-striped">
 <tr>
		<td width="415" valign="top">
			[url]URL[/url]<br/>
			[url=url]<span style="color:red">Tiêu Đề</span>[/url]
		</td>
		<td>Chèn Link vào bài viết . <br/><i> [url=<span style=" color:#00F">http://vnexress.net</span>]<span style="color:red">Link Của Tui</span>[/url]  <Br/> [url]<span style="color:red">http://mong.vn</span>[/url]</i> </td>
	</tr>
	<tr>

	<tr>
		<td width="415" valign="top">
			[youtube]<span style="color:red"> ID YOUTUBE VIDEO</span>[/youtube]<br/>
		<td>Chèn youtube video . http://www.youtube.com/watch?v=<span style="color:red">meq0zmOb8EA</span>
        <br/>Chèn như sau : <i>[youtube]<span style="color:red">meq0zmOb8EA</span>[/youtube]</i></td>
	</tr>


</table>

 </td>
 </tr>                                   
</tbody> 

 </table>                    
 </form>                       
                        
                        
                        

					</div>
					<!-- end #contentIndex -->
				</div>


			</div>
			<!-- End of row -->
		</div>
	<!-- end #wrapMain -->

<script id="template-upload-1" type="text/x-tmpl">
{% for (var i=0, file; file=o.files[i]; i++) { %}
    <tr class="template-upload fade">
        <td>
            <span class="preview"></span>
        </td>
        <td>
            <p class="name">{%=file.name%}</p>
            {% if (file.error) { %}
                <div><span class="label label-danger">Error</span> {%=file.error%}</div>
            {% } %}
        </td>
        <td>
            <p class="size">{%=o.formatFileSize(file.size)%}</p>
            {% if (!o.files.error) { %}
                <div class="progress progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0"><div class="progress-bar progress-bar-success" style="width:0%;"></div></div>
            {% } %}
        </td>
        <td>
            {% if (!o.files.error && !i && !o.options.autoUpload) { %}
                <button class="btn btn-primary start">
                    <i class="glyphicon glyphicon-upload"></i>
                    <span>Start</span>
                </button>
            {% } %}
            {% if (!i) { %}
                <button class="btn btn-warning cancel">
                    <i class="glyphicon glyphicon-ban-circle"></i>
                    <span>Cancel</span>
                </button>
            {% } %}
        </td>
    </tr>
{% } %}
</script>


	<script id="template-upload" type="text/x-tmpl">
{% for (var i=0, file; file=o.files[i]; i++) { %}
    <tr class="template-upload fade">
        <td>
            <span class="preview"></span>
        </td>
        <td>
            <p class="name">{%=file.name%}</p>
            {% if (file.error) { %}
                <div><span class="label label-danger">Error</span> {%=file.error%}</div>
            {% } %}
        </td>
        <td>
            <p class="size">{%=o.formatFileSize(file.size)%}</p>
            {% if (!o.files.error) { %}
                <div class="progress progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0"><div class="progress-bar progress-bar-success" style="width:0%;"></div></div>
            {% } %}
        </td>
        <td>
            {% if (!o.files.error && !i && !o.options.autoUpload) { %}
                <button class="btn btn-primary start">
                    <i class="glyphicon glyphicon-upload"></i>
                    <span>Start</span>
                </button>
            {% } %}
            {% if (!i) { %}
                <button class="btn btn-warning cancel">
                    <i class="glyphicon glyphicon-ban-circle"></i>
                    <span>Cancel</span>
                </button>
            {% } %}
        </td>
    </tr>
{% } %}
</script>

	<script id="template-download" type="text/x-tmpl">
{% for (var i=0, file; file=o.files[i]; i++) { %}
    <tr class="template-download fade">
        <td>
            <span class="preview">
                {% if (file.thumbnailUrl) { %}
                    <a href="{%=file.url%}" title="{%=file.name%}" download="{%=file.name%}" data-gallery><img src="{%=file.thumbnailUrl%}"></a>
                {% } %}
            </span>
        </td>
        <td>
	
            <p class="name">
                {% if (file.url) { %}
                    <a href="{%=file.url%}" title="{%=file.name%}" download="{%=file.name%}" {%=file.thumbnailUrl?'data-gallery':''%}>{%=file.name%}</a>
                {% } else { %}
                   <span>{%=file.name%}</span>
                {% } %}
            </p>
			
            {% if (file.error) { %}
                <div><span class="label label-danger">Error</span> {%=file.error%}</div>
            {% } %}
        </td>
        <td>
            <span class="size">{%=o.formatFileSize(file.size)%}</span>
        </td>
        <td>
            {% if (file.deleteUrl) { %}
                <button class="btn btn-danger delete" data-type="{%=file.deleteType%}" data-url="{%=file.deleteUrl%}"{% if (file.deleteWithCredentials) { %} data-xhr-fields='{"withCredentials":true}'{% } %}>
                    <i class="glyphicon glyphicon-trash"></i>
                    <span>Delete</span>
                </button>
                <input type="checkbox" name="delete" value="1" class="toggle">
            {% } else { %}
                <button class="btn btn-warning cancel">
                    <i class="glyphicon glyphicon-ban-circle"></i>
                    <span>Cancel</span>
                </button>
            {% } %}
        </td>
    </tr>
{% } %}
</script>

	<script type="text/javascript">
	
	$(document).ready(function(){
		
		$('#formMainImage').fileupload({
			autoUpload:true,
			dropZone: $('#formMainImage'),
			maxNumberOfFiles: 1,
	        // Uncomment the following to send cross-domain cookies:
	        //xhrFields: {withCredentials: true},
	      	url: '<?= IMAGE_URL ?>text/index.php',
	      	//url: 'http://localhost/test/jqueryupload/images/text/index.php',
	      	progressall: function (e, data) {
	            var progress = parseInt(data.loaded / data.total * 100, 10);
	            $('.progress-bar').css(
	                'width',
	                progress + '%'
	            ).text(progress + '%');
	      	},
			
	      	success: function(data){
	      		$.each(data, function(e1, value1){
	    			$.each(value1[0], function(e2, value2){
	    				if(e2 == 'name'){
		    			
	    					//$('#formMainImage').append('<input id="mainImage" type="hidden" name="mainImage" value="'+value2+'" />');
	    					$('#mainImage').val(value2);
	    					$('#mainImage_error').remove();
	    				}
	    			});
	    		});
		    }
	        
	    });
	
	$('#formMainImage').bind('fileuploaddestroy', function (e, data) {
		
		resultFileObj = parseQueryString(data.url);
		resultFile = resultFileObj.file;

		$('#mainImage').val('');
    });
	
	function parseQueryString(url) {
	    var queryStringIdx = url.indexOf('?');
	    var pairs = url.substr(queryStringIdx + 1)
	                   .split('&')
	                   .map(function(p) { return p.split('='); });
	    var result = { };
	    for (var i = 0; i < pairs.length; i++) {
	        result[decodeURIComponent(pairs[i][0])] = decodeURIComponent(pairs[i][1]);
	    }

	    return result;
	}
	
	function setImageName(data){
		$.each(data, function(e1, value1){
			$.each(value1[0], function(e2, value2){
				if(e2 == '500Url'){
					var ed = tinyMCE.get('txtDescription');                // get editor instance
					var range = ed.selection.getRng();                  // get range
					var newNode = ed.getDoc().createElement ( "img" );  // create img node
					newNode.src=value2;                           // add src attribute
					newNode.className = 'img-responsive';
					range.insertNode(newNode);
					
				}
			});
		});
		
	}
	
	$('#formMainImage').fileupload('option', {
        maxFileSize: 5000000,
        resizeMaxWidth: 1500,
        resizeMaxHeight: 4000,
        acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i
    });
	
	$('#formMainImage').fileupload(
        'option',
        'redirect',
        
        window.location.href.replace(
            /\/[^\/]*$/,
            '/cors/result.html?%s'
        )
    );

    if (window.location.hostname === 'blueimp.github.io') {
        // Demo settings:
        $('#formMainImage').fileupload('option', {
            url: '//jquery-file-upload.appspot.com/',
            // Enable image resizing, except for Android and Opera,
            // which actually support image resizing, but fail to
            // send Blob objects via XHR requests:
            disableImageResize: /Android(?!.*Chrome)|Opera/
                .test(window.navigator.userAgent),
            maxFileSize: 5000000,
            acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i
        });
        // Upload server status check for browsers with CORS support:
        if ($.support.cors) {
            $.ajax({
                url: '//jquery-file-upload.appspot.com/',
                type: 'HEAD'
            }).fail(function () {
                $('<div class="alert alert-danger"/>')
                    .text('Upload server currently unavailable - ' +
                            new Date())
                    .appendTo('#additionImages');
            });
        }
    } else {
        // Load existing files:
        $('#formMainImage').addClass('fileupload-processing');
        $.ajax({
            // Uncomment the following to send cross-domain cookies:
            //xhrFields: {withCredentials: true},
            url: $('#formMainImage').fileupload('option', 'url'),
            dataType: 'json',
            context: $('#formMainImage')[0]
        }).always(function () {
            $(this).removeClass('fileupload-processing');
        }).done(function (result) {
            $(this).fileupload('option', 'done')
                .call(this, null, {result: result});
           
        });
    }
				

			$('#textUpload').fileupload({
				dropZone: $('#textUpload'),
				
				maxNumberOfFiles: 10,
		        // Uncomment the following to send cross-domain cookies:
		        //xhrFields: {withCredentials: true},
		      	url: '<?= IMAGE_URL ?>text/index.php',
		      	//url: 'http://localhost/test/jqueryupload/images/text/index.php',
		      	progressall: function (e, data) {
		            var progress = parseInt(data.loaded / data.total * 100, 10);
		            $('.progress-bar').css(
		                'width',
		                progress + '%'
		            ).text(progress + '%');
		      	},
				
		      	success: function(data){setImageName(data);}
		        
		    });
		
		$('#textUpload').bind('fileuploaddestroy', function (e, data) {
			resultFileObj = parseQueryString(data.url);
			resultFile = resultFileObj.file;
			$('#textUpload > input:hidden').each(function(){
				if ($(this).val() == resultFile)  {
					
			        $(this).remove();
			    }
			});
	    });
		
		function parseQueryString(url) {
		    var queryStringIdx = url.indexOf('?');
		    var pairs = url.substr(queryStringIdx + 1)
		                   .split('&')
		                   .map(function(p) { return p.split('='); });
		    var result = { };
		    for (var i = 0; i < pairs.length; i++) {
		        result[decodeURIComponent(pairs[i][0])] = decodeURIComponent(pairs[i][1]);
		    }

		    return result;
		}
	
		
		$('#textUpload').fileupload('option', {
            maxFileSize: 5000000,
            resizeMaxWidth: 1500,
            resizeMaxHeight: 4000,
            acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i
        });
		
		$('#textUpload').fileupload(
	        'option',
	        'redirect',
	        
	        window.location.href.replace(
	            /\/[^\/]*$/,
	            '/cors/result.html?%s'
	        )
	    );

	    if (window.location.hostname === 'blueimp.github.io') {
	        // Demo settings:
	        $('#textUpload').fileupload('option', {
	            url: '//jquery-file-upload.appspot.com/',
	            // Enable image resizing, except for Android and Opera,
	            // which actually support image resizing, but fail to
	            // send Blob objects via XHR requests:
	            disableImageResize: /Android(?!.*Chrome)|Opera/
	                .test(window.navigator.userAgent),
	            maxFileSize: 5000000,
	            acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i
	        });
	        // Upload server status check for browsers with CORS support:
	        if ($.support.cors) {
	            $.ajax({
	                url: '//jquery-file-upload.appspot.com/',
	                type: 'HEAD'
	            }).fail(function () {
	                $('<div class="alert alert-danger"/>')
	                    .text('Upload server currently unavailable - ' +
	                            new Date())
	                    .appendTo('#textUpload');
	            });
	        }
	    } else {
	        // Load existing files:
	        $('#textUpload').addClass('fileupload-processing');
	        $.ajax({
	            // Uncomment the following to send cross-domain cookies:
	            //xhrFields: {withCredentials: true},
	            url: $('#textUpload').fileupload('option', 'url'),
	            dataType: 'json',
	            context: $('#textUpload')[0]
	        }).always(function () {
	            $(this).removeClass('fileupload-processing');
	        }).done(function (result) {
	            $(this).fileupload('option', 'done')
	                .call(this, null, {result: result});
	           
	        });
	    }
		
	    $('.createAlbum').click(function(e){
		    e.preventDefault();
		    $('#txtAlbum_message').remove();
		    $('#modalAlbumBox').remove();
		    var that = this;
			$.ajax({
				url : "<?php echo BASE_URL ?>index.php?module=user&act=ajax&albumBox=1",
				type : 'POST',
				data: {type: '<?= $_GET['act']; ?>'},
				success : function(data){
					$('.createAlbum').parent().append(data);
					$('.createAlbum').parent().find('#modalAlbumBox').modal();
				},
			});
		});

	    $('#txtTitle').blur(function(){
	    	$.ajax({
	    		url: "index.php?module=user&act=ajax&validateTitle=1",
	    		type: 'POST',
	    		data: {txtTitle: $('#txtTitle').val()},
	    		success: function(data){
	    			newData = $.parseJSON(data);
	    			if(newData.errors){
		    			
		    			if($('#txtTitle_error').length <= 0){
			    		
		    				$('#txtTitle').parent().append('<div id="txtTitle_error" class="alert alert-danger alert-dismissable" style="display: none;"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>'+newData.errors.txtTitle+'</div>');
		    				$('#txtTitle_error').slideDown('fast');
		    			}else{
							$('#txtTitle_error').html(newData.errors.txtTitle);
		    			}
	    				
	    			}else{
	    				$('#txtTitle_error').remove();
	    			}
	    		}
	    	});
	    });

	    $('#txtDescription').blur(function(){
		   
	    	//$(this).parent().find('.alert').remove();
	    	$.ajax({
	    		url: "index.php?module=user&act=ajax&validateDescription=1",
	    		type: 'POST',
	    		data: {txtDescription: $('#txtDescription').val()},
	    		success: function(data){
	    			newData = $.parseJSON(data);
	    			console.log(newData);
	    			if(newData.errors.txtDescription){
	    				if($('#txtDescription_error').length <= 0){
		    				$('#txtDescription').parent().append('<div id="txtDescription_error" class="alert alert-danger alert-dismissable" style="display: none;"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>'+newData.errors.txtDescription+'</div>');
		    				$('#txtDescription_error').slideDown('fast');
	    				}else{
							$('#txtDescription_error').html(newData.errors.txtDescription);
		    			}
	    			}else{
	    				$('#txtDescription_error').remove();
	    			}
	    		}
	    	});
	    });

	    /*
	     * Submit event
	     */
	    $('button#submitText').click(function(e){
		    
	    	e.preventDefault();
	    	$(".alert").remove();
	  		$('.userPostForm').css('opacity', '0.3');
			$('.formLoading')
			.css('width', $('.userPostForm').width())
			.css('height', $('.userPostForm').height())
			.css('opacity', '1')
			.css('z-index','9999').css('display', 'block');
			$('#wrapLoadMoreItems').css('display', 'block').center();

	    	sdes=$('#txtsdes').val();
			sdes=sdes.replace("/\n/g", "<br/>");

			if(!$('#mainImage').val()){
				txtImage = '<?php echo $pt['image']; ?>'
				
			}else{
				txtImage = $('#mainImage').val();
			}

			txtId = '<?php echo intval($_GET['id']); ?>';			
	    	$.ajax({
	    		url : "<?php echo BASE_URL; ?>index.php?module=user&act=ajax&validatePostText=1",
	    		type : 'POST',
	    	
				//exit();
	    		data : {
		    		txtId : txtId,
	    			txtTitle: $('#txtTitle').val(), 
	    			txtDescription : tinyMCE.get('txtDescription').getContent(), 
	    			txtCat : $('#txtCat').val(),
					txtsdes :  $('#txtsdes').val(),
	    			txtAlbum : $('#txtAlbum').val(),
	    			txtMainImage: txtImage,
	    			txtSourceUrl: $('#txtSourceUrl').val()
	    		},
	    		
	    		success : function(data){
					
	    			$('.formLoading').css('display', 'none');
	    			$('#wrapLoadMoreItems').css('display', 'none');
	    			$('.userPostForm').css('opacity', '1');
	    			if(data) newData = $.parseJSON(data);
	    			if(newData.errors){
	    				$.each(newData.errors, function(e, error){
		    				if(e != 'error'){
		    					$('#' + e).parent().append('<div id="'+e+'_error" class="alert alert-danger alert-dismissable" style="display: none;"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>'+error+'</div>');
		    					$('#' + e + '_error').slideDown('fast');
		    				}
	    				});
	    			}else{
	    				popupMessage('Thành công', <?= json_encode(array('Đăng bài thành công.')); ?>, 'alert-success');
		    			$('#popup_message').prepend('<div class="loading" id="mainLoading"><div id="loadMoreItems" class="normalLoadBtn"><img width="20" src="public/images/loading.gif" alt="loading" /> Loading </div><div class="clr"></div></div>');
		    			$('#mainLoading').delay(1500).slideUp(function(){
			    			if(!txtId || txtId == '' || typeof(txtId) == "undefined" || txtId == '0' || txtId == 0){

								window.location.href = '<?= UPLOAD ?>/text/';
			    			}else{
			    			}
			    		});
	    			}
	    		}
	    	});
	    });

	   
	    
	    $('.select2').select2({ width: '250' });
		$('#txtSource').select2({width: '150'});

		tinymce.init({
		    selector : '#txtDescription',
			 plugins : "advlist,autolink,lists,link,image,charmap,print,preview,table,image,fullscreen,code,paste,medialink,mediaurl",
		  toolbar1: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image print preview media | forecolor backcolor emoticons code fullscreen,paste | medialink,mediaurl",
		  height:300,
     	paste_auto_cleanup_on_paste : true,
		paste_strip_class_attributes:false,
		paste_remove_styles:true,
		force_p_newlines : false,
		force_br_newlines : true,
		forced_root_block : 'p',
      //  extended_valid_elements : "img[src|class|style],table[style|thead|tbody|tfoot|tr|td],div[style],p[style],ul[style],span[style],td[style],br",
	//	invalid_elements : "script,marquee,iframe,object,a" ,
	   extended_valid_elements : "table[style|thead|tbody|tfoot|tr|td],div[style],p[style],ul[style],span[style],td[style],br,img[src|class|style]",
	invalid_elements : "script,marquee,iframe,object,a" ,
	
		valid_child_elements : "strong/b/p/div/em/i/td[#text]",
		entity_encoding : "raw",
	    theme_advanced_resizing :true,
    	convert_urls: false
		 });
		
	});
</script>

	<script src="public/exts/js/jquery.center.js"></script>
	<script src="public/exts/js/jqueryupload/vendor/jquery.ui.widget.js"></script>
	<!-- The Templates plugin is included to render the upload/download listings -->
	<script src="public/exts/js/jqueryupload/blueimp.js"></script>

	<!-- blueimp Gallery script -->

	<!-- The Iframe Transport is required for browsers without support for XHR file uploads -->
	<script src="public/exts/js/jqueryupload/jquery.iframe-transport.js"></script>
	<!-- The basic File Upload plugin -->
	<script src="public/exts/js/jqueryupload/jquery.fileupload.js"></script>
	<!-- The File Upload processing plugin -->
	<script src="public/exts/js/jqueryupload/jquery.fileupload-process.js"></script>
	<!-- The File Upload image preview & resize plugin -->
	<script src="public/exts/js/jqueryupload/jquery.fileupload-image.js"></script>

	<!-- The File Upload validation plugin -->
	<script src="public/exts/js/jqueryupload/jquery.fileupload-validate.js"></script>
	<!-- The File Upload user interface plugin -->

	<script src="public/exts/js/jqueryupload/jquery.fileupload-ui.js"></script>